﻿using System;
using System.ComponentModel.DataAnnotations;
using Viettel.VOFFICE.DAO.Models;

namespace Viettel.VOFFICE.Web.Models
{
    public class DocTypeModel : BaseModel
    {
        public DocTypeModel() { }

        public DocTypeModel(DocumentType docType)
        {
            Id = docType.Id;
            Name = docType.Name;
            Description = docType.Description;
            IsActive = docType.IsActive;
            IsCommon = docType.IsCommon;
            BookId = docType.BookId;
            CreatedAt = docType.CreatedAt;
            UpdatedAt = docType.UpdatedAt;
            CreatorId = docType.CreatorId;
            if (BookId != null && BookId != 0)
            {
                BookName = docType.Book.Name;
            }
        }

        public int Id { get; set; }
        [Required]
        public string Name { get; set; }
        public string Description { get; set; }
        public bool? IsActive { get; set; }
        public bool? IsCommon { get; set; }
        public int? BookId { get; set; }
        public string BookName { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
        public Guid? CreatorId { get; set; }
    }
}
